//
// Copyright (c) 2013-2025 The SRS Authors
//
// SPDX-License-Identifier: MIT
//
#include <srs_utest_app8.hpp>

using namespace std;

#include <srs_app_hls.hpp>
#include <srs_core_autofree.hpp>
#include <srs_kernel_error.hpp>

// Unit tests for SrsDvrAsyncCallOnHls
VOID TEST(AppHlsTest, DvrAsyncCallOnHlsToString)
{
    // Setup mock objects
    MockRtcAsyncCallRequest mock_request("test.vhost", "live", "stream1");

    // Create SrsDvrAsyncCallOnHls instance
    SrsContextId cid;
    std::string path = "/data/hls/test/stream1-0.ts";
    std::string ts_url = "stream1-0.ts";
    std::string m3u8 = "/data/hls/test/stream1.m3u8";
    std::string m3u8_url = "stream1.m3u8";
    int seq_no = 1;
    srs_utime_t duration = 10 * SRS_UTIME_SECONDS;

    SrsUniquePtr<SrsDvrAsyncCallOnHls> task(new SrsDvrAsyncCallOnHls(cid, &mock_request, path, ts_url, m3u8, m3u8_url, seq_no, duration));

    // Test to_string method
    std::string str = task->to_string();
    EXPECT_TRUE(str.find("on_hls") != std::string::npos);
    EXPECT_TRUE(str.find(path) != std::string::npos);
}
